package com.bytz.config;

import com.bytz.modules.cms.domain.impl.order.*;
import com.bytz.modules.cms.domain.manager.MallOrderProcessorManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

@Configuration
public class MallConfig {

    //订单状态处理器
    @Bean
    public MallOrderStatusProcessor statusProcessor() {
        return new MallOrderStatusProcessor(100);
    }

    //下架产品处理器
    @Bean
    public MallOrderProductCheckProcessor productEnableProcessor() {
        return new MallOrderProductCheckProcessor(150);
    }

    //订单类型处理器
    @Bean
    public MallOrderTypeProcessor orderTypeProcessor() {
        return new MallOrderTypeProcessor(200);
    }

    //默认值处理器
    @Bean
    public MallOrderDefaultValueProcessor defaultValueProcessor() {
        return new MallOrderDefaultValueProcessor(300);
    }

    //价格处理器
    @Bean
    public MallOrderPriceProcessor priceProcessor() {
        return new MallOrderPriceProcessor(400);
    }

    //优惠券处理器
    @Bean
    public MallOrderCouponProcessor couponProcessor() {
        return new MallOrderCouponProcessor(500);
    }

    //EC处理器
    @Bean
    public MallOrderECProcessor ecProcessor() {
        return new MallOrderECProcessor(600);
    }

    //销售处理器
    @Bean
    public MallOrderSalesProcessor salesProcessor() {
        return new MallOrderSalesProcessor(700);
    }


    //订单编号生成器
    @Bean
    public MallOrderNumberGeneratorProcessor numberGeneratorProcess() {
        return new MallOrderNumberGeneratorProcessor(900);
    }

    /**
     * 订单提交时填充信息处理器
     */
    @Bean
    public MallOrderDeliveryDateProcessor baseInfoProcessor() {
        return new MallOrderDeliveryDateProcessor(1000);
    }

    /**
     * 订单处理器管理器
     * @param abstractProcessList 处理器
     * @return
     */
    @Bean
    public MallOrderProcessorManager orderProcessorManager(List<MallOrderAbstractProcessor> abstractProcessList) {
        return new MallOrderProcessorManager(abstractProcessList);
    }
}